<?php
namespace Home\Model;
use Think\Model;


class WebsitesModel extends Model{

	/****
	登陆信息确认
	$info信息的传递至
	****/
	public function loginsure($info){
		$result=$this->where('loginaccount="'.$info['username'].'" and password="'.$info['password'].'"')->select();
		if(empty($result)){
			$result=array('success'=>'1','msg'=>'用户名或者密码有误!');
		}else{
			$result=array('success'=>'0','msg'=>'登陆成功!','data'=>$result);
		}
		return $result;
	}

	/*****
	registersure()确认注册的身份信息
	****/
	public function registersure($info){
		$result=$this->where('loginaccount="'.$info['regisusername'].'"')->select();
		if(!empty($result)){
			return array('success'=>'1','msg'=>'用户名已被注册!');
		}
		$data['name']='AL'.date('YmdHis');
		$date['url']='www.lovetrival.com';
		$data['loginaccount']=$info['regisusername'];
		$data['password']=$info['regispassword'];
		$result=$this->data($data)->add();
		if(is_numeric($result)){
			$result=$this->where('id="'.$result.'"')->select();
			if(!empty($result)){
				$result=array('success'=>'0','data'=>$result,'msg'=>'注册成功!');
			}else{
				$result=array('success'=>'4','msg'=>'系统繁忙!');
			}
		}else{
			$result=array('success'=>'2','msg'=>'插入失败!');
		}
		return $result;
	}
}



?>